﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Smartee.RichText
{
    public sealed class Table : Container
    {
        private List<Row> _rows = new List<Row>();
        public TextDirection Direction { get; private set; }
        public Measurement[] ColumnsWidth { get; private set; }
        public Justification[] ColumnsJustification { get; private set; }

        public Table(TextDirection tableDirection, Measurement[] columnsWidth, Justification[] columnsJustification)
        {
            Direction = tableDirection;
            ColumnsWidth = columnsWidth;
            ColumnsJustification = columnsJustification;
        }

        public void Add(Row newRow) { _rows.Add(newRow); }

        public override void Accept(IVisitor visitor)
        {
            visitor.StartVisit(this);
            foreach (Row row in _rows)
                row.Accept(visitor);
            visitor.EndVisit(this);
        }
    }
}
